package babymall.service;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import babymall.dao.IAdminDao;
import babymall.model.Admin;
import babymall.model.AdminDTO;

@Service
public class AdminServiceImpl implements IAdminService {

	@Resource
	private IAdminDao dao;
	
	@Override
	public Admin login(Admin a) {
		return dao.login(a);
	}

	@Override
	public int add(Admin a) {
		return dao.add(a);
	}

	@Override
	public int edit(Admin a) {
		return dao.edit(a);
	}

	@Override
	public int del(int id) {
		return dao.del(id);
	}

	@Override
	public int editPwd(AdminDTO a) {
		int n = 0;
		Admin admin = dao.getAdminByPwd(a);
		if(admin!=null) {//如果旧密码验证通过
			n = dao.editPwd(a);
		}
		return n;
	}

}
